﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

    <script type="text/javascript" src="js/angular.js"></script>
</head>
<body ng-app="testApp" ng-controller="testCtl">
    <h1>test login</h1>
    <div>
        <button ng-click="onLogin()">login</button>
    </div>

    <h1>test post (http-content/json)</h1>
    <div>
        <button ng-click="onClick()">post-en-us</button>
        <button ng-click="onClickZHCN()">post-zh-cn</button>
    </div>

    <h2>test post (http-content/form)</h2>
    <form method="post" action="./Api.ashx?sys:sno=test&sys:act=post" enctype="application/x-www-form-urlencoded">
        <label>Id</label>
        <input name="Id" value="abc1"/>
        <br />
        <label>StrArr</label>
        <input name="StrArr" value="aaa1"/>
        <br />
        <input name="StrArr" value="bbb1" />
        <br />
        <input name="StrArr" value="ccc1" />
        <br />
        <button type="submit">post</button>
    </form>
    <h2>test post (file)</h2>
    <form method="post" action="./Api.ashx?sys:sno=test&sys:act=PostFile" enctype="multipart/form-data">
        <label>TAG</label>
        <input name="TAG" value="abc1" />
        <br><label>File1</label>
        <input name="File1" type="file" />
        <br />
        <button type="submit">post</button>
    </form>
</body>

</html>
<script>
    var app = angular.module('testApp', []);
    app.controller('testCtl', function ($scope, $http) {
        $scope.onLogin = function () {
            debugger;
            $http({
                method: 'post',
                url: './Api.ashx?sys:sno=sys&sys:act=login&sys:lang=en-us',
                data: { Id: 'abc', StrArr: ['aaa', 'bbb'] }
            }).success(function (data) {
                debugger;
                alert(data.Message);
            });
        };
        $scope.onClick = function () {
            $http({
                method: 'post',
                url: './Api.ashx?sys:sno=test&sys:act=post&sys:lang=en-us',
                data: { Id: 'abc', StrArr: ['aaa', 'bbb'] }
            }).success(function (data) {
                debugger;
                alert(data.Message);
            });
        };
        $scope.onClickZHCN = function () {
            $http({
                method: 'post',
                url: './Api.ashx?sys:sno=test&sys:act=post&sys:lang=zh-cn',
                data: { Id: 'abc', StrArr: ['aaa', 'bbb'] }
            }).success(function (data) {
                debugger;
                alert(data.Message);
            });
        };
    });
</script>
